#include "drawingstudio.h"
#include "drawingdesigner.h"

namespace ShUi
{

class DrawingStudioImpl : public Impl<DrawingStudio>
{
public:
    void init();
    void exit();
    DrawingDesigner* _designer;
};

void DrawingStudioImpl::init()
{
    SH_Q(DrawingStudio);
    q->setOrganizationName(SH_ORG_NAME);
    q->setApplicationName(SH_APP_NAME);
    q->setApplicationVersion(SH_APP_VER);
    _designer = new DrawingDesigner();
    _designer->present();
}

void DrawingStudioImpl::exit()
{
    delete _designer;
}

DrawingStudio::DrawingStudio(int& argc, char** argv) :
    QApplication(argc, argv)
{
    SH_I(DrawingStudio);
    d->init();
}

DrawingStudio::~DrawingStudio()
{
    SH_E(DrawingStudio);
    d->exit();
}

int DrawingStudio::start()
{
    return exec();
}

DrawingDesigner* DrawingStudio::designer() const
{
    SH_D(const DrawingStudio);
    return d->_designer;
}

} // namespace ShUi
